package decorator.decorator;

import decorator.Drink;

/**
 * @author : DuJiabao
 * @Date : 2021/3/3 14:37
 * @Project : design-pattern
 * @File : null.java
 * @Desc :
 */
public abstract class Decorator extends Drink {
  Drink drink;

  public Decorator(Drink drink) {
    this.drink = drink;
  }

  public Decorator(String desc, double price, Drink drink) {
    super(desc, price);
    this.drink = drink;
  }

  @Override
  public double cost() {
    return this.getPrice() + drink.cost();
  }

  @Override
  public String getDescription() {
    return drink.getDescription() + super.getDesc() + " " + super.getPrice() + " ";
  }
}
